<?php

/*
 * модель файла
 */

class Model_File {
    private $pathToFile;
    private $pathToMiniFile;
    private $fileName;
    private $finalWidthOfImage = 130;
    private $userId;
    public function __construct($data, $id) {
        
        if (preg_match('/[.](jpg)|(gif)|(png)$/i', $data['fupload']['name'])) {
            $this->fileName = $data['fupload']['name'];
            $this->tmpPath = $data['fupload']['tmp_name'];
            $this->pathToFile = "./img/$id/$this->fileName";
            $this->pathToMiniFile = "./img/$id/thumb/$this->fileName";
            $this->userId = $id;
            }
    }
    public function getTmpPath(){
            return $this->tmpPath;
        }    
    public function getFileName(){
            return $this->fileName;
        }    
    public function getPathToFile(){
            return $this->pathToFile;
        }
    public function getPathToMiniFile(){
            return $this->pathToMiniFile;
        }
    public function getUserId(){
            return $this->userId;
        }
    public function getFinalWidthOfImage(){
        return $this->finalWidthOfImage;
    }
    public static function getSTime(){
        $mtime = microtime(); 
        $sTime = $mtime;
        return $sTime;
    }
    public static function getTime($stime){
        $mtime = microtime();
        $Time = $mtime - $sTime;
        return $Time; 
    }
    
}

